<template>
  <div id="iap-toolbar">
    <el-row>
      <el-button type="primary" size="mini" v-for="(item, index) in buttonsObj" :key="index" @click="handleClick(item.oprType)">{{ item.text }}</el-button>
    </el-row>
  </div>
</template>
<script>
export default {
  name: 'iToolbar',
  props: {
    buttonsObj: {
      type: Array,
      default: function () {
        return [
          { text: '新增', oprType: 'add' }
        ]
      }
    }
  },
  watchs: {
    buttonsObj: {
      handler: function (val) {
        this.buttonsObj = val
      },
      deep: true
    }
  },
  data () {
    return {}
  },
  methods: {
    handleClick (oprType) {
      this.$emit('click', oprType)
    }
  }
}
</script>
<style lang="stylus">
#iap-toolbar
  padding 15px
  background #fff
</style>
